﻿// (c) Copyright 2013 Mike Riedel.
// This source is subject to the Microsoft Public License (Ms-PL).
// All other rights reserved.

namespace FreshMeat.Threading
{
   /// <summary>
   /// Provides a lock that doesn't actually do anything.
   /// Useful for testing or perhaps bypassing locking in situations where it
   /// isn't useful without changing code that was written to always use locking.
   /// </summary>
   public class NullReaderWriterLock : IReaderWriterLock
   {
      /// <summary>
      /// Gets the lock for read access.
      /// </summary>
      /// <returns></returns>
      public ILock Read()
      {
         return NullLock.Instance;
      }

      /// <summary>
      /// Gets the lock for write access.
      /// </summary>
      /// <returns></returns>
      public ILock Write()
      {
         return NullLock.Instance;
      }
   }
}
